home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MAGCARD.ZIP / MAGCARD1.TXT < prev    next >
Internet Message Format  |  1996-07-08  |  13KB

  1. From: brian@ucsd.edu (Brian Kantor)
  2. Newsgroups: sci.electronics
  3. Subject: Re: Encoding Scheme of Mag Stripe Cards?
  4. Organization: The Avant-Garde of the Now, Ltd.
  5.  
  6. >Does anybody know how information is encoded on the magnetic stripe for
  7. >credit cards, bank cards, my student id, etc.?  Any references?  A trip
  8. >to the library and looking thru the reader 's guide didn't get me anywhere.
  9.  
  10. Well, there's three tracks (ISO 3554), all 0.110" wide. The top one is
  11. 210 BPI and has 7 bits per chr. (incl. parity). Total 79 alpha-num. chrs.
  12. The second track has 75 BPI, 5 bits per chr. (incl. par.) total 40 digits
  13. The third track has agian 210 BPI, 5 bits per chr (yeah incl. par.) total
  14. 107 digits.
  15.  
  16. Data is coded reversing the polarity of the magnetic field once or twice in
  17. the field for that bit. Since you cannot double of half the speed of the card
  18. within the space for 1 bit, it all works.
  19.  
  20. >I just bought a card reader which had 5 ttl level outputs.  Two for each
  21. >of 2 head tracks and a 5th that goes low when a card is being run thru.
  22. >The chips don't seem to be identifiable.
  23.  
  24. Well, the bad news is that you'll have to write the decoding software yourself.
  25. Not much to it, I did it on a Commodore-64. Our magazine ("Hack-Tic") printed
  26. the full specs on all this in the last issue.
  27. -- 
  28. Rop Gonggrijp (ropg@ooc.uva.nl) is also editor of  Hack-Tic (hack/phreak mag.)
  29. quote: "We don't care about freedom of the mind, | Postbus 22953    (in DUTCH)
  30.         freedom of signature will do just fine"  | 1100 DL  AMSTERDAM
  31. Any opinions in this posting are wasted on you   | tel: +31 20 6001480
  32.  
  33.  
  34. From ucsd!swrinde!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!psuvax1!rutgers!dayton!jad Fri Sep 28 04:18:32 PDT 1990
  35.  
  36. > Article <28174@pasteur.Berkeley.EDU> From: e142-aq@hercules.Berkeley.EDU
  37. > (Alan Nishioka)
  38. >Does anybody know how information is encoded on the magnetic stripe for
  39. >credit cards, bank cards, my student id, etc.?  Any references?  A trip
  40. >to the library and looking thru the reader 's guide didn't get me anywhere.
  41.  
  42. You'll want to see the American National Standard X4.16 (which I
  43. just happen to have sitting in my lap.)  It is available from the
  44.  
  45.     American National Standards Institute, Inc.
  46.     1430 Broadway
  47.     New York, NY  10018
  48.  
  49. My version is dated 1983.  I suspect it has been superceded by now.
  50. It details everything (everything!) you ever could possibly want to
  51. know about mag stripe encoding for financial services cards.
  52.  
  53. >I just bought a card reader which had 5 ttl level outputs.  Two for each
  54. >of 2 head tracks and a 5th that goes low when a card is being run thru.
  55. >The chips don't seem to be identifiable.
  56.  
  57. In most all of the MSR's I've taken apart, the chips are custom.
  58. One of our vendor's configurations for the wiring looked like this:
  59.  
  60.     1    RDT1    Data from track 1
  61.     2    RCL1    Clock from track 1
  62.     3    GND
  63.     4    +5V
  64.     5    n/c
  65.     6    RCL2    Clock from track 2
  66.     7    CLD    Card Presence
  67.     8    RDT2    Data from track 2
  68.  
  69. You could use a scope to determine which is which -- track 2 is recorded
  70. at 75 bits/inch while track 1 is 210 bits/inch.  Just watch the blinking!
  71. The data is self clocking.
  72.  
  73.       _____       __    __    _____    __
  74.      |     |_____|  |__|  |__|     |__|  |_____
  75.      ^     ^     ^     ^     ^     ^     ^
  76.         0     0     1     1     0     1     0
  77.  
  78. >I discovered that cards seem to use two different levels of stripe, for
  79. >a total of 4 tracks on my bank card, but only two on my student id, which
  80. >are at the wrong level for my reader.
  81.  
  82. Your bank card will typically only use the read-only tracks one and two.
  83. Track 3 is a read/write track that has the same electromagnetic properties
  84. as track 1, but its usage is not standardized within the industry.  Many
  85. cards issued today do not even have magnetic media at the location for
  86. track 3.  (It was originally intended for off-line ATM authorization,
  87. but guess what happened to that idea!)
  88.  
  89. >The code must be self-clocking and I would guess just have simple 
  90. >error checking (parity) since the card can just be run thru again if
  91. >necessary.
  92.  
  93. The parity checking is pretty impressive.  Track 1 characters are 6
  94. bits plus one (odd) parity bit.  There is also an LRC (Longitudinal
  95. Redundancy Check) character after the end sentinel character.  The
  96. LRC bits are parity bits for all the characters in the track such
  97. that the total one bits are odd.  (The LRC parity bit is simply a
  98. parity check on the LRC character.)  This scheme protects against
  99. almost all random card damage, as you would have to have four bits
  100. wrong (the corners of a rectangle, physically) to escape detection.
  101. Track 2 parity detection is the same, but track 2 characters are
  102. only 4 bits plus one (odd) parity bit.
  103.  
  104. The character sets are fairly simple subsets of ASCII.  Tracks 1 & 3
  105. use this table:
  106.  
  107.         0    1    2    3
  108.             00    01    10    11 <-MSD
  109.  
  110.      0    0000    SP    0    @a    P
  111.      1    0001    !a    1    A    Q
  112.      2    0010    "a    2    B    R
  113.      3    0011    #b    3    C    S
  114.      4    0100    $    4    D    T
  115.      5    0101    %c    5    E    U
  116.      6    0110    &a    6    F    V
  117.      7    0111    'a    7    G    W
  118.      8    1000    (    8    H    X
  119.      9    1001    )    9    I    Y
  120.      A    1010    *a    :a    J    Z
  121.      B    1011    +a    ;a    K    [d
  122.      C    1100    ,a    <a    L    \d
  123.      D    1101    -    =a    M    ]d
  124.      E    1110    .    >a    N    ^c
  125.      F    1111    /    ?c    O    _d
  126.  
  127.      a    For the encoding of data on magnetic stripe cards, these
  128.     character positions shall not contain information characters
  129.     (data content).
  130.  
  131.      b    Optional additional graphic.
  132.  
  133.      c    These characters shall have the following meaning for this application:
  134.     25  %  represents start sentinel.
  135.     3F  ?  represents end sentinel.
  136.     5E  ^  represents separator.
  137.  
  138.      d    These character positions are reserved for additional national
  139.     characters when required.  They shall not be used internationally.
  140.  
  141.  
  142. Track 1 format:
  143.  
  144. Format A.  Reserved for proprietary use of card issuer.
  145.  
  146. Format B.
  147. Start sentinel        1 character
  148. Format code = "B"    1 character - alpha only
  149. Primary Account Number    Up to 19 characters (Note 1)
  150. Separator        1 character
  151. Country code        3 characters (Note 2)
  152. Name            2-26 characters (note 3)
  153.   Surname
  154.   Surname separator="/"
  155.   First name or initial
  156.   Space (when required) (Note 4)
  157.   Middle name or initial
  158.   Period (when followed by title)
  159.   Title (when used)
  160. Separator        1 character
  161. Expiration date or    4 characters or 1 character
  162.   separator        (Note 5)
  163. Discretionary data    The balance to maximum record length
  164. End sentinel        1 character
  165. LRC            1 character (see above for LRC calculation)
  166. Total            79 characters max.
  167.  
  168. Notes:
  169.      1    In accordance with the account numbering scheme in ANSI X4.13-1983.
  170.      2    When the primary account number commences with major industry
  171.     identifier "5" followed by "9", the encoding of the country
  172.     in this position is mandatory.  In all other situations, the
  173.     expiration date or separator shall immediately follow the
  174.     separator that terminates the primary account number.  The
  175.     country code for the United States is 840.
  176.      3    The absolute minimum data encoded in the name field will be
  177.     a single alpha character in the surname area and the surname
  178.     separator (/).
  179.      4    The space character is required to separate the logical elements
  180.     of the name field other than the surname.  The separator terminating
  181.     the name field should be encoded following the last logical element
  182.     of the name field.  If only the surname is encoded, it will follow
  183.     the surname separator.
  184.      5    In accordance with ANSI X3.30-1971.  If no expiration date is
  185.     associated with the card, a separator shall be encoded.  The
  186.     format for the expiration date is YYMM.
  187.  
  188. Format Codes C through M.  The format codes are reserved for use by
  189. ANSI Subcommittee X3B10 in connection with other data formats of track 1.
  190.  
  191. Format Codes N through Z.  Available for use by individual card issuers.
  192.  
  193.  
  194. Track 2 uses the following 4 bit character set:
  195.  
  196.      0    0000    0
  197.      1    0001    1
  198.      2    0010    2
  199.      3    0011    3
  200.      4    0100    4
  201.      5    0101    5
  202.      6    0110    6
  203.      7    0111    7
  204.      8    1000    8
  205.      9    1001    9
  206.      A    1010    Note 1
  207.      B    1011    Start sentinel (start character)
  208.      C    1100    Note 2
  209.      D    1101    Separator
  210.      E    1110    Note 1
  211.      F    1111    End sentinel (stop character)
  212.  
  213. Notes:
  214.      1    These characters are available for hardware control purposes
  215.     and shall not be used for data content.
  216.  
  217.      2    This character is reserved for future definition in connection
  218.     with the data format on track 2.
  219.  
  220. Track 2 format:
  221.  
  222. Start sentinel        1 character
  223. Primary Account Number    Up to 19 characters (Note 1)
  224. Separator        1 character
  225. Country code        3 characters (Note 2)
  226. Expiration date or    4 characters or 1 character
  227.   separator        (Note 3)
  228. Discretionary data    The balance to maximum record length
  229. End sentinel        1 character
  230. LRC            1 character (see above for LRC calculation)
  231. Total            40 characters max.
  232.  
  233. Notes:
  234.      1    In accordance with the account numbering scheme in ANSI X4.13-1983.
  235.      2    When the primary account number commences with major industry
  236.     identifier "5" followed by "9", the encoding of the country
  237.     in this position is mandatory.  In all other situations, the
  238.     expiration date or separator shall immediately follow the
  239.     separator that terminates the primary account number.  The
  240.     country code for the United States is 840.
  241.      3    In accordance with ANSI X3.30-1971.  If no expiration date is
  242.     associated with the card, a separator shall be encoded.  The
  243.     format for the expiration date is YYMM.
  244.  
  245. >BTW, I just want to read, not commit bank fraud :-)  I would have to build
  246. >another card input/output assembly for that :-)
  247.  
  248. I've seen some scams based on ATM card fraud, but it may be tough to
  249. fool Mother Visa...particularily when you have to hand your card to
  250. a living, breathing human.
  251.  
  252. Do me a favor and mail me a copy of your interface circuit when you
  253. get it working, OK?
  254.  
  255. -j, now you know all our little secrets, eh?
  256. -- 
  257. J. Deters                            Ask me about my PS/2.        //
  258. INTERNET:  jad@dayton.DHDSC.MN.ORG   Then,                       //
  259. UUCP:  ...!bungia!dayton!jad         ask me about my Amiga!  \\ //
  260. ICBM:  44^58'36"N by 93^16'12"W                               \X/
  261.  
  262.  
  263. From ucsd!dog.ee.lbl.gov!pasteur!cory.Berkeley.EDU!atn Wed May  8 07:41:21 PDT 1991
  264.  
  265.  
  266. Just got my new California driver's license.  No, I'm not 17, but I take the
  267. bus a lot.
  268.  
  269. It has a holographic plastic laminate of "DMV" and the California Seal.
  270.  
  271. My color picture was digitized into and IBM computer as was my thumb print
  272. and my signature.  The mag stripe on the back has three tracks.
  273.  
  274. Just for fun, I thought I'd try to read it.  I had previously been able
  275. to read bank cards (with help from sci.electronics).  I found that the
  276. information encoded is basically just what is printed on the card.  Kinda
  277. uninteresting.  Of course I couldn't figure out what little extra information
  278. was encoded.... (marked unidentified below)
  279.  
  280. It took me a little while to figure out the format, and I suppose it is
  281. documented somewhere (anyone know where?) but it was fun.
  282.  
  283. Bank Cards -- conform to ANSI/ISO 7810-1985 ($10)
  284. Track 1:    6 bit word with 1 bit parity.  LSB first.
  285.             code offset 32 below ASCII code.
  286. Track 2:    4 bit word with 1 bit parity.  LSB first.  Numbers only.
  287.  
  288. Driver's License --
  289. Track 1:    6 bit word with no parity.  Otherwise same as Bank Card.
  290. Track 2:    Same as Bank Card.
  291.  
  292. California Driver's License:
  293. ---------------------------
  294. Track 2:    (low density)
  295.     8 unidentified digits
  296.     License Number
  297.     Separator
  298.     Expiration Date (YYMM)
  299.     Separator
  300.     Date of Birth (YYYYMMDD)
  301.  
  302. Track 1:    (High density)
  303. DALAN TAKEO NISHIOKA                                       $
  304. 974 TULARE AVE               ALBANY       
  305.     Name (58 characters)
  306.     Address (29 characters)
  307.     City (13 characters)
  308.  
  309. Track 3:    (High density.  Can't reposition read head. );
  310.  
  311. Great Western Bank ATM Card:
  312. ---------------------------
  313. Track 2:
  314.     Account number on the front of the card
  315.     Separator
  316.     Expiration date (no country code)
  317.     Other (propietary) data
  318.  
  319. Track 1:
  320.     Format B
  321.     Account number
  322.     Separator
  323.     Name (from front of card)
  324.     Separator
  325.     Expiration date (no country code)
  326.     Other data
  327.  
  328. AT&T Universal Card:
  329. -------------------
  330. Track 1:
  331.     Format B
  332.     Account Number
  333.     Separator
  334.     Name
  335.     Separator
  336.     Expiration Date (YYMM)
  337.     6 Unknown chars
  338.     Calling Card Number (10 digits)
  339.  
  340. Track 2:
  341.     Account Number
  342.     Separator
  343.     Expiration Date (YYMM)
  344.     3 Unknown chars
  345.  
  346. Citibank ATM Card:
  347. -----------------
  348. Track 1:
  349.     Format A (proprietary)
  350.     Name
  351.     Separator
  352.     Account Number
  353.     Separator
  354.     Expiration Date (MMYY)
  355.     7 Unidentified chars 
  356.  
  357. Track 2:
  358.     Account Number
  359.     Separator
  360.     Expiration Date (MMYY)
  361.     7 Unidentified chars
  362.  
  363. -----------------------------------------------------------------------------
  364. Alan Nishioka      KC6KHV      atn@cory.berkeley.edu      ...!ucbvax!cory!atn
  365. 974 Tulare Avenue, Albany CA 94707-2540     37'52N/122'15W    +1 415 526 1818
  366.  
  367.